Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill level change api #8

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Fill level change api #8

wants to merge 3 commits into from

Conversation

ammar450
Copy link

No description provided.

@@ -53,7 +57,7 @@ initializeMQTT(globalEventEmitter);

// Middleware
app.use(bodyParser.json());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the new middleware, that you added, we dont need this line anymore, right? How about moving line 25 and 26 to here and removing the bodyparser.json?

if (!user.projects.includes(updatedProject._id)) {
user.projects.push(updatedProject._id);
if (!user?.projects.includes(updatedProject._id ) && user) {
console.log("users",user)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove log


if (projectQuery) {
// Check if the projectQuery is a valid ObjectId
if (mongoose.Types.ObjectId.isValid(projectQuery)) {
// console.log("Querying trashbins by ObjectId:", projectQuery);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out log

trashbins = await Trashbin.find({ project: projectQuery })
.populate('assignee')
.populate('project');
} else {
//console.log("Querying trashbins by project identifier:", projectQuery);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out log

if (project) {
trashbins = await Trashbin.find({ project: project._id })
.populate('assignee')
.populate('project');
// console.log("Fetched trashbins:", trashbins);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out log

@@ -1,11 +1,13 @@
import { generateUniqueTrashbinIdentifier } from '../service/trashbin';
import { Project } from '../models/project';
import { Trashbin } from '../models/trashbin';
import { History } from '../models/history';
import { Types } from 'mongoose';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you check for example line 151 you can see, that they were already referencing mongoose.Types. So I would propose to either remove this import and do line 411 with "mongoose.Types" or change the other references to just "Types" and removing the import in line 7.
Whichever you prefer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants